package client;

import java.net.*;
import java.io.*;

public class ClientThread implements Runnable {

    private String clientNo;

    public ClientThread(String clientNo) {
        this.clientNo = clientNo;
    }

    public void run() {
        try {
            //Attach to local host on port 2001
            Socket s = new Socket("127.0.0.1", 2001);
            PrintWriter pw = new PrintWriter(s.getOutputStream(), true);
            System.out.println("Message from client " + clientNo + " sent");
            Thread.sleep(20);
            pw.println("" + clientNo);
            pw.close();
            s.close();
        } catch (Exception e) {
            System.out.println("Problem setting up client thread" + clientNo + " " + e.getMessage());
        }
    }
}